package MyMap;

import java.util.*;

public class test2 {
    public static void main(String[] args) {
        HashMap<String, ArrayList<String>> hm = new HashMap<>();
        ArrayList<String> list1 = new ArrayList<>();
        list1.add("邯郸市");
        list1.add("唐山市");
        list1.add("秦皇岛市");
        list1.add("张家口市");
        ArrayList<String> list2 = new ArrayList<>();
        list2.add("11");
        list2.add("22");
        list2.add("33");
        list2.add("44");
        hm.put("河北省",list1);
        hm.put("四川省",list2);
        Set<Map.Entry<String, ArrayList<String>>> set = hm.entrySet();
        for (Map.Entry<String, ArrayList<String>> stringArrayListEntry : set) {
            String key = stringArrayListEntry.getKey();
            ArrayList<String> value = stringArrayListEntry.getValue();
            StringJoiner sj = new StringJoiner(",","","");
            for (String city : value) {
                sj.add(city);
            }
            System.out.println(key + "=" + sj);
        }
    }
}
